package com.weic.manager.evaluate.controller;

import com.weic.manager.controller.BaseController;
import com.weic.manager.evaluate.service.EvaluateService;
import com.weic.manager.evaluate.service.EvaluateServiceImpl;
import com.weic.manager.vo.EvaluateVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

/**
 * 评价类
 */
@Controller
@RequestMapping(value = "/evaluate")
public class EvaluateController extends BaseController {

    @Autowired
    EvaluateServiceImpl evaluateServiceImpl;

    /**
     * 测评列表
     * @param request
     * @param response
     * @return
     */
    @RequestMapping(value = "/evaluation_list.html")
    public ModelAndView articleList(HttpServletRequest request , HttpServletResponse response){

        return new ModelAndView("/evaluation_list.html");
    }


    @RequestMapping(value = "/getTopEvaluate.json")
    public @ResponseBody Map<String,Object> getTopEvaluate(){
        List<EvaluateVO> evaluateVOS = evaluateServiceImpl.selectTop(3);
        return genAjaxResponse(true,"请求成功！",evaluateVOS);
    }
}
